home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / lib / tex / inputs / named.sty < prev    next >
Encoding:
Text File  |  1991-05-21  |  3.1 KB  |  77 lines

  1. % This file implements citations for the ``named'' bibliography style.
  2. %  Place it in a file called named.sty in the TeX search path.  (Placing it
  3. % in the same directory as the LaTeX document should also work.)
  4.  
  5. % Prepared by Peter F. Patel-Schneider, with the assistance of several,
  6. % since forgotten, LaTeX hackers.
  7. % This style is NOT guaranteed to work.  It is provided in the hope
  8. % that it will make the preparation of papers easier.
  9. %
  10. % There are undoubtably bugs in this style.  If you make bug fixes,
  11. % improvements, etc.  please let me know.  My e-mail address is:
  12. %    pfps@research.att.com
  13.  
  14. % The preparation of this file was supported by Schlumberger Palo Alto
  15. % Research and AT\&T Bell Laboratories.
  16.  
  17. % This file can be modified and used in other conferences as long
  18. % as credit to the authors and supporting agencies is retained, this notice
  19. % is not changed, and further modification or reuse is not restricted.
  20.  
  21. % The ``named'' bibliography style creates citations with labels like
  22. %    \citeauthoryear{author-info}{year}
  23. % these labels are processed by the following commands:
  24. %    \cite{key}
  25. %        which produces citations with both author and year,
  26. %        enclosed in square brackets
  27. %    \shortcite{key}
  28. %        which produces citations with year only,
  29. %        enclosed in square brackets
  30. %    \citeauthor{key}
  31. %        which produces the author information only
  32. %    \citeyear{key}
  33. %        which produces the year information only
  34.  
  35. % Bugs:  Using \cite and \shortcite in vertical mode (usually as the first
  36. % thing in a paragraph) does not work.  A simple fix might work, but I'm
  37. % not ready to delve into TeX at the moment.
  38.  
  39. \def\@up#1{\raise.2ex\hbox{#1}}
  40.  
  41. \let\@internalcite\cite
  42. \def\cite{\def\@citeseppen{-1000}%
  43.  \def\@cite##1##2{\@up[\nobreak\hskip 0in{##1\if@tempswa , ##2\fi}\@up]}%
  44.  \def\citeauthoryear##1##2{##1, ##2}\@internalcite}
  45. \def\shortcite{\def\@citeseppen{1000}%
  46.  \def\@cite##1##2{\@up[{##1\if@tempswa , ##2\fi}\@up]}%
  47.  \def\citeauthoryear##1##2{##2}\@internalcite}
  48.  
  49. \def\citeauthor#1{\def\@citeseppen{1000}%
  50.  \def\@cite##1##2{{##1\if@tempswa , ##2\fi}}%
  51.  \def\citeauthoryear##1##2{##1}\@citedata{#1}}
  52. \def\citeyear#1{\def\@citeseppen{1000}%
  53.  \def\@cite##1##2{{##1\if@tempswa , ##2\fi}}%
  54.  \def\citeauthoryear##1##2{##2}\@citedata{#1}}
  55.  
  56. \def\@citedata#1{\@tempswafalse%
  57.  \if@filesw\immediate\write\@auxout{\string\citation{#1}}\fi
  58.   \def\@citea{}\@cite{\@for\@citeb:=#1\do
  59.     {\@citea\def\@citea{,\penalty\@citeseppen\ }\@ifundefined
  60.        {b@\@citeb}{{\bf ?}\@warning
  61.        {Citation `\@citeb' on page \thepage \space undefined}}%
  62. {\csname b@\@citeb\endcsname}}}{}}
  63.  
  64. % don't box citations, separate with ; and a space
  65. % also, make the penalty between citations negative: a good place to break
  66. \def\@citex[#1]#2{\if@filesw\immediate\write\@auxout{\string\citation{#2}}\fi
  67.   \def\@citea{}\@cite{\@for\@citeb:=#2\do
  68.     {\@citea\def\@citea{;\penalty\@citeseppen\ }\@ifundefined
  69.        {b@\@citeb}{{\bf ?}\@warning
  70.        {Citation `\@citeb' on page \thepage \space undefined}}%
  71. {\csname b@\@citeb\endcsname}}}{#1}}
  72.  
  73. % raise the brackets in bibliography labels
  74. \def\@biblabel#1{\def\citeauthoryear##1##2{##1, ##2}%
  75.   \raise.2ex\hbox{[}#1\raise.2ex\hbox{]}\hfill}
  76.  
  77.